public class Test {
    public static void main(String[] args) {
        String s1 = "hello bit";
        System.out.println(s1);
        String s2 = new String("hello,bit");
        System.out.println(s2);
        char[]array = {'h','e','l','l','o'};
        String s3 = new String(array);
        System.out.println(s3);

        String s4 = "word";
        String s5 = s4;
        System.out.println(s5);
        System.out.println(s1.isEmpty());
        int a = 10;
        int b = 20;
        int c = 10;//对于内置类型，比较的是存储的数值是否相同
        System.out.println(a ==b);
        System.out.println(a==c);
        String b1 = new String("hello");
        String b2 = new String("word");//对于引用类型，比较的是引用中的地址是否相同
        String b3= b2;
        System.out.println(b1==b2);
        System.out.println(b2 ==b3);


        String c1 = "hello";
        String c2 = "hello";
        String c3 = "word";
        System.out.println(c1.equals(c2));
        System.out.println(c1.equals(c3));//equals比较的是引用的内容是否相同


        String z1 = "abc";
        String z2 = "abc";
        String z3 = "abcd";
        String z4 = "abcdef";
        String z5 = "safh";
        System.out.println(z1.compareTo(z1));
        System.out.println(z1.compareTo(z2));
        System.out.println(z1.compareTo(z3));
        System.out.println(z1.compareTo(z4));
        System.out.println(z1.compareTo(z5));
        String x1 = "ABC";
        System.out.println(z1.compareToIgnoreCase(x1));//忽略大小写的比较
        String a1 = "1234";
        System.out.println(a1);
        int date1 = Integer.parseInt("1356");
        System.out.println(date1);
        //字符串中大小写的转换
        String q1 = "hellow word";
        String q2 ="FDGJKLGL";
        System.out.println(q1.toUpperCase());
        System.out.println(q2.toLowerCase());
        //字符串转数组
        System.out.println("==========================");
        String t1 = "hdfsghl";
        char[] ch = t1.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            System.out.println(ch[i]);
        }
        System.out.println(ch);
        //数组转字符串
        String t2 = new String(ch);

        System.out.println("==============================");
        String o1 = String.format("%d-%d-%d",2023,12,7);
        System.out.println(o1);

        String str = "hello word";
        System.out.println(str.replaceAll("|",","));

    }
}
